package com.clh.seckill.rabbitmq;

import com.clh.seckill.config.TopicRabbitMQConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author cailinhu
 * @Description 生产者
 * @Date 2022/1/12 10:46
 * @Version 1.0
 */
@Component
@Slf4j
public class MQSender {
    @Autowired
    private RabbitTemplate rabbitTemplatetemplate;

    public void sendSeckillMessage(String message){
        log.info("生产者收到的消息:"+message);
        rabbitTemplatetemplate.convertAndSend(TopicRabbitMQConfig.EXCHANGE_NAME,"seckill.message",message);
    }


}
